﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WRJ
{
	public partial class ManageUserScore : BaseDBUserControl
	{
		int UserID;
		string[] title={"系统编号","用户编号","考核名称","考核成绩","考核时间","备注"};

		public ManageUserScore(MainMenuDB menu, Button button, string UserName, int ID)
		{
			InitializeComponent();
			
			UserID = ID;
			button.Enabled = false;
			menu.Text = "管理员模式 —— 成绩管理（用户名："+UserName+"）";

			databaseWRJDataSet1.ExamInfo.DefaultView.RowFilter = "UserID ="+ID;
			dataGridView1.DataSource = databaseWRJDataSet1.ExamInfo;
			
			for (int i = 0; i < title.Length; i++)
			{
				dataGridView1.Columns[i].HeaderText = title[i];
				dataGridView1.ColumnHeadersDefaultCellStyle.Alignment =DataGridViewContentAlignment.MiddleCenter;
			}
			
			examInfoTableAdapter1.Fill(databaseWRJDataSet1.ExamInfo);

			AcceptButton.Click += new EventHandler(AcceptButton_Click);
		}

		void ScoreButton_Click(object sender, EventArgs e)
		{
			
		}

		void AcceptButton_Click(object sender, EventArgs e)
		{
			try
			{
				examInfoTableAdapter1.Update(databaseWRJDataSet1.ExamInfo);
				MessageBox.Show("数据提交成功！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message,"错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
			}
			
		}
		
		public Button ScoreButton;
	}
}
